package com.schoolcloud.front.controller;

import com.schoolcloud.common.model.R;
import com.schoolcloud.front.service.FroPermissionService;
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
@RequestMapping("/front/permission")
@RequiredArgsConstructor
public class FroPermissionController {
    private final FroPermissionService froPermissionService;

    @GetMapping("/by/{userId}")
    public R<List<String>> getPermissionCodesByUserId(@PathVariable String userId){
      List<String> codeList=  froPermissionService.getPermissionCodesByUserId(userId);
      return R.ok(codeList);
    }
}
